\chapter{Software Design | J\"org Miller}\label{chap:softwareDesign}

\section{Architectural Model}\label{sec:architecturalModel}
Because the to be developed webshop is accessed via the Internet, a three-tiered software architecture, as used in many client-server applications, has been chosen. The modular design of a three-tier architecture was the main reason that led to this decision. Its benefits are:
\begin{itemize}
	\item There is a clear distinction between the tiers or layers, they provide their own part of the overall functionality.
	\item Each tier/layer exposes its functionality to adjacent layers through well-defined interfaces. As long as these interfaces do not change, each tier can be updated or altered independently.
	\item Developers are able to build a flexible and reusable application.
\end{itemize}

The three tiers of the chosen architecture, which are also shown in figure \ref{fig:cs}, are: 

\begin{description}
	\item[Presentation Tier:] Customers as well as administrators of the webshop interact with the presentation layer. They operate from remote machines and send their requests over the internet via a browser.
	\item[Application Tier:] Represented by a webserver that handles the incoming requests from clients. When the request has been processed, an appropriate answer message will be sent to the client.
	\item[Data Tier:] May reside on the same physical machine as the webserver, but is logically separated from it. The data tier usually consists of a database management system that can be queried for information (e.g. using SQL).
\end{description}

\begin{figure}
	\centering
	\includegraphics[width=1\textwidth]{images/Architecture.jpg}
	\caption{Client-server architecture}
	\label{fig:cs}
\end{figure}

\section{Webshop Evaluation}\label{sec:shopEvaluation}
First considerations quickly showed that the team would have to use a prebuilt webshop solution. With the project being that limited in terms of time, budget and resources, developing a webshop from scratch seems infeasible. Again, with respect to the budget limitations, the decision should be made for a open source webshop. A pre-selection of four open source webshops had been made and for these it was determined which one would best suit the team's needs. The four webshops investigated further were: 
\begin{description}
	\item[PrestaShop] PrestaShop\footnote{http://www.prestashop.com} is published under the Open Software License v3.0 and has about 50000 registered shops. It is based on PHP and MySQL and its modular design allows users to extend the functionality by adding new modules.
	\item[osCommerce] Licensed under the GNU General Public License, the osCommerce\footnote{http://www.oscommerce.com} webshop solution has started in 2001 and is supported by a large and active community. It is highly customisable in terms of design and functionality and offers a broad range of modules to install.
	\item[xt:Commerce] Originally based on osCommerce, the newest version of xt:Commerce\footnote{http://www.xt-commerce.com} has been completely redesigned and is now a stand-alone product. It offers a community edition with limited functionality that is free to download as well as as two commercial releases with extended features.
	\item[Oxid] Similar to xt:Commerce, the Oxid\footnote{http://www.oxid-esales.com} webshop is available as a free (licensed under the GNU General Public License) and a commercial version. As all webshop solutions it offers a wide range of extensions and ways of modification to tailor each shop to user's needs. 
\end{description}

To give a brief overview over the capabilities of the four webshops, table \ref{tbl:shopProperties} shows a few basic characteristics for each webshop:

\vspace{.5cm}
%\begin{longtable}{l|c|c|c|c}
\begin{longtable}{p{30mm}|p{25mm}|p{25mm}|p{25mm}|p{25mm}}
 	\hline
 	\textbf{Property} & \textbf{PrestaShop} & \textbf{osCommerce} & \textbf{xt:Commerce} & \textbf{Oxid}\\
 	\hline
 	\hline
 	Operating system & \multicolumn{4}{|c}{platform independent}\\
 	\hline
 	Programming language & \multicolumn{4}{|c}{PHP}\\
 	\hline
 	Customizable design & \multicolumn{4}{|c}{yes, via templates}\\
 	\hline
 	Cost & \multicolumn{2}{|c|}{free} & \multicolumn{2}{|c}{free community edition} \\
 	\hline
 	Administration & \multicolumn{4}{|c}{web-based}\\
 	\hline
 	Database interface & MySQL & MySQL & MySQL, Oracle & MySQL\\
 	\hline
 	Multilanguage support & 38 languages & 16 languages & 10 languages & 2 languages\\
 	\hline
 	Payment system & Cash on delivery, PayPal & PayPal & 8 systems (PayPal, credit card, ...) & Credit card, cash on delivery \\
 	\hline
	\caption{Basic webshop properties}
	\label{tbl:shopProperties}
\end{longtable}

\subsection{Evaluation Criteria}
In order to make profound statements on which webshop to choose, the team named a number of properties each shop should provide. Based on the evaluation criteria listed below, the shop that best suited the team's purpose was determined. 

\begin{description}
	\item[Covering functional requirements] The webshop provides features that are needed to cover all functional requirements (e.g. shopping cart). 
	\item[Community support] The shop has a large and active community that offers technical support and ensures further development of the system.
	\item[Security] Customers should be able to purchase products in a safe way. The system should withstand attacks like Cross-site-scripting or SQL-injection.
	\item[Flexibility] The shop's design can be easily customized.
	\item[Extensibility] More functionality can be easily added in case the shop's requirements change. 
	\item[Integration] How easy is it to install the system on the company's machines?
	\item[Documentation] How well is the system documented? Are the resources easy to understand and comprehensive? 
\end{description}

\vspace{.5cm}
\noindent
In the following, each property has been assigned a weight or priority according to the level of importance of this property to the team members. Marks will be awarded to the candidates if they fully ('+', equals 2 marks), partially ('0', equals 1 mark) or do not ('-', equals 0 marks) satisfy a requirement. Combined with the weight of a requirement an overall mark for this property can be determined. Table \ref{tbl:shopEvaluation} shows the results and total marks for each shop candidate. 

\vspace{.5cm}
%\begin{longtable}{p{25mm}|p{12mm}|p{25mm}|p{25mm}|p{25mm}|p{25mm}}
\begin{longtable}{p{30mm}|c|cccc}
 	\textbf{Property} & \textbf{Prio} & \textbf{PrestaShop} & \textbf{osCommerce} & \textbf{xt:Commerce} & \textbf{Oxid}\\
 	\hline
 	\textbf{Functional requirements} & 3 & + & + & + & +\\
 	\textbf{Community} & 3 & - & + & + & 0\\
 	\textbf{Security} & 2 & + & - & 0 & +\\
 	\textbf{Flexibility} & 2 & 0 & + & 0 & +\\
 	\textbf{Extensibility} & 3 & + & 0 & + & +\\
 	\textbf{Integration} & 2 & + & 0 & 0 & +\\
 	\textbf{Documentation} & 1 & 0 & + & + & 0\\
 	\hline
 	\textbf{Sum} & & 23 & 23 & 26 & 28\\
 	\hline
	\caption{Webshop evaluation properties}
	\label{tbl:shopEvaluation}
\end{longtable}

\vspace{.5cm}
\noindent
The shop evaluation shows that all four shop systems perform at a similar level. None of them is not capable of providing the basic capabilities needed to fulfill the functional requirements and none of them fails to satisfy the requirements that have been given a high priority. There are only subtile differences in details and in the end the Oxid webshop finishes slightly ahead of the other platforms. Therefore the team has made the decison to employ their webshop using the Oxid system.